

import java.util.ArrayList;

import Entities.AssessmentEntity;
import logic.MySQLconnection;
import fit.ActionFixture;
import gui.AcademicFrame;
import gui.ServerGui;

public class SignificationAssessment extends ActionFixture
{
	AssessmentEntity assessment = new AssessmentEntity();
	
	ServerGui server;
	AcademicFrame client;
	
	public void setupfixture()
	{
		server = new ServerGui();
		server.fakeServer(5555, "mysql://localhost/test", "root", "Braude");
		server.myLog.setVisible(false);
		client = new AcademicFrame("Localhost",5555);
		
	}

	public void setRid (String requestID)
	{
		assessment.setRid(requestID);
	}
	
	public void setLocation(String location)
	{
		assessment.setLocation(location);
	}
	
	public void setDuration()
	{
		assessment.setDurationAssessment("5");
	}
	
	public void setChangeDescription (String description)
	{
		assessment.setChangeDescription(description);
	}
	
	public void setBenefit(String benefit)
	{
		assessment.setBenefit(benefit);
	}
	
	public void setConstrictions (String constrictions)
	{
		assessment.setConstrictions(constrictions);
	}
	
	public boolean significationAssessment()
	{
		
				
		ArrayList<Object> question = new ArrayList<Object>();
		ArrayList<Object> answer = new ArrayList<Object>();
		
		question.add("NewAssessmentRow");
		question.add(assessment);
		client.myclient.sendMessageToServer(question);	
		while (client.answer==null);
		answer = client.answer;
		client.answer=null;
		
		if ( ((String)(answer.get(1))).equalsIgnoreCase("AssessmentSet") || ((String)(answer.get(1))).equalsIgnoreCase("ExistingAssessmentRow") )
			return true;
		else
			return false;
	}
}

